﻿@{
    Html.Telerik().Menu()
        .Name("ToolsMenu")
        .Items(items =>
        {
            if (Request.IsAuthenticated)
            {
                items.Add()
                    .Text(User.Identity.Name)
                    .Items(sousItems =>
                    {
                        sousItems.Add()
                            .Action("LogOff", "Account", new { area = "" })
                            .Text("Afficher mon profil");

                        sousItems.Add()
                            .Action("LogOff", "Account", new { area = "" })
                            .Text("Déconnexion");
                    });
            }
            else
            {
                items.Add()
                    .Action("LogOn", "Account", new { area = "" })
                    .Text("Se connecter");
            }

            items.Add()
                .Text("Themes")
                .Items(sousItems =>
                {
                    string themeIdSelected = Html.GetCurrentTheme();
                    IEnumerable<string> themes = Html.GetAllThemesName();

                    foreach (string theme in themes)
                    {
                        sousItems.Add().Text(theme).Action("ChangeTheme", "Themes", new { id = theme }).Selected(theme.Equals(themeIdSelected, StringComparison.InvariantCultureIgnoreCase));
                    }
                });

            items.Add()
                .Text("Aide");
        })
        .HighlightPath(false)
        .Effects(effects =>
        {
            effects.Slide().OpenDuration(0).CloseDuration(0);
        })
        .Render();
}

